#include<stdio.h>
int main()
{
	int a, b, m, n;
	scanf_s("%d%d", &n, &m);
	a = (4 * n - m) / 2;
	b = (m - 2 * n) / 2;
	printf("%d\n%d", a ,b);
	return 0;
}